package com.li.controller;

import com.li.pojo.ReturnMessage;
import com.li.pojo.TBUser;
import com.li.pojo.User;
import com.li.service.TBUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class TBUserController {
    @Autowired
    private TBUserService tbUserService;

    @RequestMapping("/deleteTBUsers")
    public ReturnMessage deleteUser(){
        ReturnMessage returnMessage = new ReturnMessage();
        returnMessage.setMsg("删除成功");
        return returnMessage;
    }
    @RequestMapping("/updateTBUser")
    public ReturnMessage updateUser(TBUser user){
        ReturnMessage returnMessage = new ReturnMessage();
        System.out.println("更新:");
        System.out.println(user);
        tbUserService.updateUser(user);
        returnMessage.setMsg("用户："+user.getUserName()+"更新成功!");
        returnMessage.setData(user);
        return returnMessage;
    }
    @RequestMapping("selectAllTBUsers")
    public List<TBUser> selectAllUsers(){
        return tbUserService.selectAllUsers();
    }

}
